import java.lang.reflect.Array;
import java.util.Arrays;

public class Main {
    /*public static void main4(String[] args) {
        int[] array ={1,1,1,1,2,2,2};
       int ret = fun(array);
        System.out.println(ret);

    }
    public static int fun(int[] array){
        Arrays.sort(array);

        return array[array.length/2];
    }
   public static void main5(String[] args) {
       int[] arr = {2,3,4,5,6,7,9,3};
       System.out.println(threeCount(arr));
   }
   public static boolean threeCount(int[] arr){
       int count = 0;
       for(int i =  0;i<arr.length;i++){
           if(arr[i]%2!=0){
               count++;
               if(count==3){
                   return true;
               }
           }else{
               count=0;
           }
       }
       return false;
   }
   public static void 1main(String[] args) {

       int[] array1 = {2,66,4,5};
       //int[] copy = Arrays.copyOf(array1,array1.length*2);//数组拷贝,扩容
       int[] copy = Arrays.copyOfRange(array1,0,3);
       System.out.println(Arrays.toString(copy));
   }
   public static void main(String[] args) {
       int[][] array = {{1,2,3},{4,5,6}};
       int[][] array3 = new int[2][3];
       for (int i = 0; i < array.length; i++) {
           for (int j = 0; j < array[i].length; j++) {
               System.out.print(array[i][j]+" ");
           }
           System.out.println();
       }
       System.out.println(Arrays.deepToString(array));
        for(int[] rey:array){
            for(int x:rey){
                System.out.print(x+" ");
            }
            System.out.println();
        }
   }

    public static void main(String[] args) {
        int[][] array = new int[2][3];
        array[0] = new int[]{1,2};
        array[1] = new int[]{1,2,3};
        for(int[] arr:array){
            for(int x:arr){
                System.out.print(x+" ");
            }
            System.out.println();
        }
    }

    public static void main(String[] args) {
        int[][] arr = {{1, 2, 3}, {6, 8, 7}};
        double a = avg(arr);
        System.out.println(a);
    }
    public static double avg(int[][] arr) {
        double s = 0;
        int count = arr[0].length + arr[1].length;
        for (int[] rey : arr) {
            for (int x : rey) {
                s += x;
            }
        }
        return s / count;
    }
    public static void main(String[] args) {
        int[][] arr = {{1, 2, 3}, {6, 8, 7}};
        System.out.println(sum(arr));
    }
    public static int sum(int[][] arr){
        int s = 0;
        for(int[] rey:arr){
            for(int x:rey){
                s+=x;
            }
        }
        return s;
    }


    public static void main(String[] args) {
        int[][] arr = {{1, 2, 3}, {6, 8, 7}};
        int[][] copy = ret(arr);
        System.out.println(Arrays.deepToString(copy));
    }
    public static int[][] ret(int[][] arr) {
        for(int i = 0;i<arr.length;i++){
            for(int j = 0;j<arr[i].length;j++){
                arr[i][j]*=2;
            }
        }
        return arr;
    }
    public static void main(String[] args) {
        int[] arr = {1, 4, 43, 45};
        printArray(arr);
    }

    public static void printArray(int[] arr) {
        for (int x : arr) {
            System.out.print(x + " ");
        }
    }

    public static void main(String[] args) {
        int[] arr = new int[100];
        for(int i = 0;i<arr.length;i++){
            arr[i] = i+1;
            System.out.print(arr[i]+" ");
            if(i%9==0){
                System.out.println();
            }
        }
    }

    public static void main(String[] args) {
        int[] arr = {1,2,3,4};
        int[] copy = Arrays.copyOfRange(arr,0,4);
        System.out.println(Arrays.toString(copy));
    }
    public static void main(String[] args) {
        int[] arr ={3,6,5,3,9,6,7,10,1,89,54,65,76,32};
        int flg = 0;
        for(int i = 0;i<arr.length-1;i++){
            for(int j = 0;j<arr.length-1-i;j++){
                if(arr[i]>arr[j]){
                    int temp = arr[j];
                    arr[j] = arr[i];
                    arr[i] =temp;
                    flg= 1;
                }
            }
            if(flg==0){
                System.out.println(Arrays.toString(arr));
            }
        }
        System.out.println(Arrays.toString(arr));
    }

    public static void main(String[] args) {
        //int[] arr = {1, 4, 3, 2, 5, 6, 7, 9, 8};
        int[] arr = {1,2,3,4,5,6,7,8,9};
        int flg = 1;
        for (int i = 0; i < arr.length-1; i++) {
            if (arr[i] > arr[i + 1]) {
                System.out.println("无序");
                flg = 0;
                break;
            }
        }
        if (flg == 1) {
            System.out.println("有序且为升序");
        }
    }

    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4, 5, 6, 7, 8};
        middle(arr);
    }
    public static int middle(int[] arr) {
        int number = 4;
        int right = arr.length - 1;
        int left = 0;
        int mid = (right + left) / 2;
        while (right >= left) {
            if (number > arr[mid]) {
                left = mid + 1;
            } else if (number < arr[mid]) {
                right = mid - 1;
            } else {
                System.out.println(mid);
                break;
            }
            mid = (left + right) / 2;
        }
        return -1;
    }

    public static void main(String[] args) {
        int[] arr = {1,2,3};
        toString(arr);
    }
    public static void toString(int[] arr){
        System.out.print("\"[");
        for(int i = 0;i<arr.length;i++){
            if(i==arr.length-1){
                System.out.print(arr[i]);
                break;
            }
            System.out.print(arr[i]+",");
        }
        System.out.println("]\"");

    }

    public static void main(String[] args) {
        int[] arr={1,4,3,2,98,65,66,78};
        int count = 0;
        for (int i = 0; i < arr.length-1; i++) {
            for (int j = 0; j < arr.length-1-i; j++) {
                if(arr[j]>arr[j+1]){
                    int temp = arr[j];
                    arr[j]= arr[j+1];
                    arr[j+1] = temp;
                    count =1;
                }
            }
            if(count==0){
                System.out.println(Arrays.toString(arr));
            }
        }
        System.out.println(Arrays.toString(arr));
    }
     */
    class Student{
        public String name;
        public int age;

        public void eat(){
            System.out.println(name+"吃饭!");
        }
    }
    public static void main(String[] args) {
        Student student1 = new Student();
        student1.name = "xhanfcai";

        Student student2 = new Student();

    }


}







